@zonos/elements 1.3.92 → 1.3.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{CheckoutConfig-850071ae.js → CheckoutConfig-8e8a0d1c.js} +1 -1
- package/dist/cjs/{cart-d456e0b8.js → cart-9d0ced11.js} +13 -4
- package/dist/cjs/{createCustomEvent-94c259c7.js → createCustomEvent-f6317809.js} +2 -2
- package/dist/cjs/{handleFetch-45e76490.js → handleFetch-5a16f2bc.js} +1 -1
- package/dist/cjs/index.cjs.js +9 -9
- package/dist/cjs/{paypal-5c5f8d32.js → paypal-a6ddcfaf.js} +2 -2
- package/dist/cjs/zonos-address_7.cjs.entry.js +2 -2
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +4 -4
- package/dist/cjs/zonos-checkout.cjs.entry.js +42 -39
- package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
- package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +2 -2
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
- package/dist/cjs/zonos-hello.cjs.entry.js +2 -2
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
- package/dist/cjs/zonos-notification_3.cjs.entry.js +3 -3
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +37 -34
- package/dist/collection/components/store/checkout/cart.js +6 -1
- package/dist/collection/components/store/checkout/stripe.js +6 -2
- package/dist/collection/components/utils/logging/log.js +1 -1
- package/dist/esm/{CheckoutConfig-c0ec120d.js → CheckoutConfig-c54d23b8.js} +1 -1
- package/dist/esm/{cart-1083aa3b.js → cart-ef2e2eec.js} +13 -4
- package/dist/esm/{createCustomEvent-a45228e7.js → createCustomEvent-73760da0.js} +2 -2
- package/dist/esm/{handleFetch-0133265e.js → handleFetch-ce924688.js} +1 -1
- package/dist/esm/index.js +10 -10
- package/dist/esm/{paypal-a2399ed3.js → paypal-cce03d02.js} +2 -2
- package/dist/esm/zonos-address_7.entry.js +2 -2
- package/dist/esm/zonos-cart-items_12.entry.js +4 -4
- package/dist/esm/zonos-checkout.entry.js +42 -39
- package/dist/esm/zonos-controller.entry.js +2 -2
- package/dist/esm/zonos-country-flag.entry.js +2 -2
- package/dist/esm/zonos-country-select_4.entry.js +2 -2
- package/dist/esm/zonos-hello-dialog.entry.js +2 -2
- package/dist/esm/zonos-hello.entry.js +2 -2
- package/dist/esm/zonos-language-select_2.entry.js +2 -2
- package/dist/esm/zonos-notification_3.entry.js +3 -3
- package/dist/esm-es5/{CheckoutConfig-c0ec120d.js → CheckoutConfig-c54d23b8.js} +1 -1
- package/dist/esm-es5/{cart-1083aa3b.js → cart-ef2e2eec.js} +1 -1
- package/dist/esm-es5/createCustomEvent-73760da0.js +1 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{paypal-a2399ed3.js → paypal-cce03d02.js} +1 -1
- package/dist/esm-es5/zonos-address_7.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-95b4ea5e.js → p-021c2035.js} +1 -1
- package/dist/zonos-elements/{p-340408f2.system.entry.js → p-205d1fd0.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-dbe8a5de.entry.js → p-3242242f.entry.js} +1 -1
- package/dist/zonos-elements/{p-8aad6abd.system.js → p-332ccd38.system.js} +1 -1
- package/dist/zonos-elements/{p-f13738a1.entry.js → p-36050826.entry.js} +1 -1
- package/dist/zonos-elements/{p-ba0aef88.system.entry.js → p-517444c0.system.entry.js} +1 -1
- package/dist/zonos-elements/p-52542b33.system.js +1 -0
- package/dist/zonos-elements/{p-7995965e.entry.js → p-52b7a342.entry.js} +1 -1
- package/dist/zonos-elements/{p-3d6a7efd.entry.js → p-55534ab4.entry.js} +1 -1
- package/dist/zonos-elements/{p-1560ee37.entry.js → p-6037f297.entry.js} +1 -1
- package/dist/zonos-elements/{p-57aa09e7.system.js → p-606e0443.system.js} +1 -1
- package/dist/zonos-elements/p-609209fe.entry.js +1 -0
- package/dist/zonos-elements/{p-e8c3387c.system.entry.js → p-61c43b0c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-362bd7de.js → p-7141699d.js} +1 -1
- package/dist/zonos-elements/{p-d8a3b001.system.entry.js → p-832535b5.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b8e85bf5.js → p-9a13b43f.js} +1 -1
- package/dist/zonos-elements/{p-8e4348e9.entry.js → p-a8fb9ec4.entry.js} +1 -1
- package/dist/zonos-elements/{p-4e3d23ad.system.entry.js → p-a92ea268.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b53f9c25.system.js → p-acb212b2.system.js} +1 -1
- package/dist/zonos-elements/{p-8dc1342e.js → p-ad8b87ec.js} +1 -1
- package/dist/zonos-elements/{p-c39c3ed6.entry.js → p-c6950e78.entry.js} +1 -1
- package/dist/zonos-elements/{p-52fdf52d.system.entry.js → p-c6f848d6.system.entry.js} +1 -1
- package/dist/zonos-elements/p-c78dd680.system.js +1 -1
- package/dist/zonos-elements/{p-cf28a962.entry.js → p-c990f553.entry.js} +1 -1
- package/dist/zonos-elements/{p-1f1aaf73.system.entry.js → p-d42d729b.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-460cc134.system.entry.js → p-d8c3540c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-ded2ae47.system.entry.js → p-dbc57aea.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-ed276123.system.entry.js → p-e11d7951.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e9ee2062.entry.js → p-e2bbd294.entry.js} +1 -1
- package/dist/zonos-elements/{p-4854c65b.system.js → p-e3432dca.system.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/createCustomEvent-a45228e7.js +0 -1
- package/dist/zonos-elements/p-403b3460.entry.js +0 -1
- package/dist/zonos-elements/p-8c0ff373.system.js +0 -1
- /package/dist/esm-es5/{handleFetch-0133265e.js → handleFetch-ce924688.js} +0 -0
- /package/dist/zonos-elements/{p-197c5707.system.js → p-480556ea.system.js} +0 -0
- /package/dist/zonos-elements/{p-ad7ce197.js → p-539cc913.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const handleFetch = require('./handleFetch-
|
|
3
|
+
const handleFetch = require('./handleFetch-5a16f2bc.js');
|
|
4
4
|
|
|
5
5
|
const getTempCartById = async (cartId) => {
|
|
6
6
|
const { errors, json } = await handleFetch.handleFetch('/api/zonos-elements/get-temp-cart', {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
4
|
-
const handleFetch = require('./handleFetch-
|
|
4
|
+
const handleFetch = require('./handleFetch-5a16f2bc.js');
|
|
5
5
|
const isDarkColor = require('./isDarkColor-5efc8367.js');
|
|
6
6
|
const getBorderRadius = require('./getBorderRadius-5a64574c.js');
|
|
7
7
|
|
|
@@ -9486,8 +9486,12 @@ const stripeStoreConfirmPayment = async () => {
|
|
|
9486
9486
|
const stripeStoreInitCheckoutSession = async () => {
|
|
9487
9487
|
var _a, _b;
|
|
9488
9488
|
const total = cartStore.items.reduce((amount, item) => amount + item.amount * item.quantity, 0);
|
|
9489
|
-
if (!
|
|
9490
|
-
handleFetch.logError(
|
|
9489
|
+
if (!localizationStore.targetCurrency) {
|
|
9490
|
+
handleFetch.logError(`Failed to create checkout session - missing localizationStore.targetCurrency`);
|
|
9491
|
+
return false;
|
|
9492
|
+
}
|
|
9493
|
+
if (!total) {
|
|
9494
|
+
handleFetch.logError(`Failed to create checkout session - missing total amount of items`);
|
|
9491
9495
|
return false;
|
|
9492
9496
|
}
|
|
9493
9497
|
stripeStore.isFetchingSession = true;
|
|
@@ -9865,13 +9869,18 @@ const cartStoreReCalculateTotal = async ({ adjustmentsAmount, cartId, currency,
|
|
|
9865
9869
|
presentmentCountryCode: localizationStore.selectedCountryCode,
|
|
9866
9870
|
});
|
|
9867
9871
|
if (errors.length > 0 || !json) {
|
|
9868
|
-
// do nothing if we can't get checkout session
|
|
9869
9872
|
handleFetch.logError('Error occurs when updating checkout session.');
|
|
9870
9873
|
if (shouldInitSessionOnFailure) {
|
|
9871
9874
|
handleFetch.log('Initiating checkout session on failure', 'info');
|
|
9872
9875
|
const success = await stripeStoreInitCheckoutSession();
|
|
9873
9876
|
handleFetch.log(`stripeStoreInitCheckoutSession: ${success}`);
|
|
9874
9877
|
if (!success) {
|
|
9878
|
+
cartStoreUpdateToErrorState({
|
|
9879
|
+
messages: [
|
|
9880
|
+
translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists"),
|
|
9881
|
+
],
|
|
9882
|
+
title: translate('Error creating Checkout'),
|
|
9883
|
+
});
|
|
9875
9884
|
return false;
|
|
9876
9885
|
}
|
|
9877
9886
|
return true;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const cart = require('./cart-
|
|
3
|
+
const cart = require('./cart-9d0ced11.js');
|
|
4
4
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
5
|
-
const handleFetch = require('./handleFetch-
|
|
5
|
+
const handleFetch = require('./handleFetch-5a16f2bc.js');
|
|
6
6
|
|
|
7
7
|
const trackConversionEvent = async (eventName, metadata) => {
|
|
8
8
|
var _a, _b;
|
|
@@ -55,7 +55,7 @@ const log = (message, type, ..._additionalInfo) => {
|
|
|
55
55
|
loggingIframe.style.visibility = 'hidden';
|
|
56
56
|
document.body.appendChild(loggingIframe);
|
|
57
57
|
}
|
|
58
|
-
// use the logging iframe's console to log just in case the console is disabled (
|
|
58
|
+
// use the logging iframe's console to log just in case the console is disabled (overridden) by the site owner
|
|
59
59
|
const zConsole = ((_b = loggingIframe.contentWindow) === null || _b === void 0 ? void 0 : _b.window.console) || window.console;
|
|
60
60
|
switch (type) {
|
|
61
61
|
case 'warn':
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const handleFetch = require('./handleFetch-
|
|
6
|
-
const CheckoutConfig = require('./CheckoutConfig-
|
|
5
|
+
const handleFetch = require('./handleFetch-5a16f2bc.js');
|
|
6
|
+
const CheckoutConfig = require('./CheckoutConfig-8e8a0d1c.js');
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Get the load version and url based on the loadScriptSrc and version
|
|
@@ -97,7 +97,7 @@ const getZonosQaUrl = () => {
|
|
|
97
97
|
return null;
|
|
98
98
|
}
|
|
99
99
|
const qaUrl = extractZonosQaUrl(window.location.href);
|
|
100
|
-
const cdnUrl = "https://v1.3.
|
|
100
|
+
const cdnUrl = "https://v1.3.93.js.zonos.com";
|
|
101
101
|
// when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
|
|
102
102
|
if (!qaUrl &&
|
|
103
103
|
(cdnUrl.includes('test.') ||
|
|
@@ -281,10 +281,10 @@ const zonosLoadUrl = (() => {
|
|
|
281
281
|
}
|
|
282
282
|
return null;
|
|
283
283
|
})();
|
|
284
|
-
const ZONOS_URL = "https://v1.3.
|
|
285
|
-
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.
|
|
286
|
-
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.
|
|
287
|
-
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.
|
|
284
|
+
const ZONOS_URL = "https://v1.3.93.js.zonos.com";
|
|
285
|
+
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.93";
|
|
286
|
+
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.93";
|
|
287
|
+
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.93";
|
|
288
288
|
const INTER_FONT_URL = 'https://rsms.me';
|
|
289
289
|
const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
|
|
290
290
|
const INTER_FONT_REGEX = /^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;
|
|
@@ -299,7 +299,7 @@ Zonos.zonosConversionTest = typeof window !== 'undefined' &&
|
|
|
299
299
|
!!window.location.search.match(/\?.*(&*)zonosConversionTest/);
|
|
300
300
|
Zonos._paypalMockResponse = null;
|
|
301
301
|
Zonos.isBigCommerce = false;
|
|
302
|
-
Zonos.releaseDate = "
|
|
302
|
+
Zonos.releaseDate = "1729003957102";
|
|
303
303
|
Zonos.isLegacyCheckout = false;
|
|
304
304
|
/**
|
|
305
305
|
* By default, the package will load from npm
|
|
@@ -307,7 +307,7 @@ Zonos.isLegacyCheckout = false;
|
|
|
307
307
|
Zonos.isNpm = true;
|
|
308
308
|
Zonos.zonosQaUrl = null;
|
|
309
309
|
Zonos.zonosQaUrlApi = null;
|
|
310
|
-
Zonos.version = `v${"1.3.
|
|
310
|
+
Zonos.version = `v${"1.3.93"}`;
|
|
311
311
|
Zonos.modeAlerted = false;
|
|
312
312
|
Zonos.cartData = null;
|
|
313
313
|
Zonos.paypal = null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
4
|
-
const cart = require('./cart-
|
|
5
|
-
const handleFetch = require('./handleFetch-
|
|
4
|
+
const cart = require('./cart-9d0ced11.js');
|
|
5
|
+
const handleFetch = require('./handleFetch-5a16f2bc.js');
|
|
6
6
|
const isDarkColor = require('./isDarkColor-5efc8367.js');
|
|
7
7
|
|
|
8
8
|
/*!
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-9d0ced11.js');
|
|
7
7
|
const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
|
|
8
|
-
const handleFetch = require('./handleFetch-
|
|
8
|
+
const handleFetch = require('./handleFetch-5a16f2bc.js');
|
|
9
9
|
const containsNonLatinChars = require('./containsNonLatinChars-2be5129b.js');
|
|
10
10
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
11
11
|
const classes = require('./classes-b7918f56.js');
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-9d0ced11.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
|
-
const paypal = require('./paypal-
|
|
8
|
+
const paypal = require('./paypal-a6ddcfaf.js');
|
|
9
9
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
10
|
-
const createCustomEvent = require('./createCustomEvent-
|
|
10
|
+
const createCustomEvent = require('./createCustomEvent-f6317809.js');
|
|
11
11
|
const getBorderRadius = require('./getBorderRadius-5a64574c.js');
|
|
12
|
-
const handleFetch = require('./handleFetch-
|
|
12
|
+
const handleFetch = require('./handleFetch-5a16f2bc.js');
|
|
13
13
|
const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
|
|
14
14
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
15
15
|
const isDarkColor = require('./isDarkColor-5efc8367.js');
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const paypal = require('./paypal-
|
|
6
|
+
const cart = require('./cart-9d0ced11.js');
|
|
7
|
+
const paypal = require('./paypal-a6ddcfaf.js');
|
|
8
8
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
9
|
-
const createCustomEvent = require('./createCustomEvent-
|
|
9
|
+
const createCustomEvent = require('./createCustomEvent-f6317809.js');
|
|
10
10
|
const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
|
|
11
|
-
const handleFetch = require('./handleFetch-
|
|
11
|
+
const handleFetch = require('./handleFetch-5a16f2bc.js');
|
|
12
12
|
const classes = require('./classes-b7918f56.js');
|
|
13
13
|
const getBorderRadius = require('./getBorderRadius-5a64574c.js');
|
|
14
14
|
const isDarkColor = require('./isDarkColor-5efc8367.js');
|
|
15
|
-
const CheckoutConfig = require('./CheckoutConfig-
|
|
15
|
+
const CheckoutConfig = require('./CheckoutConfig-8e8a0d1c.js');
|
|
16
16
|
const RemoveIcon = require('./RemoveIcon-081ac073.js');
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -380,12 +380,6 @@ const ZonosCheckout = class {
|
|
|
380
380
|
catch (err) {
|
|
381
381
|
// stop loading
|
|
382
382
|
cart.stripeStore.isFetchingSession = false;
|
|
383
|
-
cart.cartStoreUpdateToErrorState({
|
|
384
|
-
messages: [
|
|
385
|
-
cart.translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists"),
|
|
386
|
-
],
|
|
387
|
-
title: cart.translate('Error creating Checkout'),
|
|
388
|
-
});
|
|
389
383
|
// We want to log the error anytime we fail to create a checkout session
|
|
390
384
|
void handleFetch.sendErrorLog({
|
|
391
385
|
endpoint: 'Error creating Checkout',
|
|
@@ -397,6 +391,12 @@ const ZonosCheckout = class {
|
|
|
397
391
|
storeBaseUrl: (_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl,
|
|
398
392
|
},
|
|
399
393
|
});
|
|
394
|
+
cart.cartStoreUpdateToErrorState({
|
|
395
|
+
messages: [
|
|
396
|
+
cart.translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists"),
|
|
397
|
+
],
|
|
398
|
+
title: cart.translate('Error creating Checkout'),
|
|
399
|
+
});
|
|
400
400
|
}
|
|
401
401
|
}, {
|
|
402
402
|
// Trigger this event before any other event
|
|
@@ -435,6 +435,7 @@ const ZonosCheckout = class {
|
|
|
435
435
|
*/
|
|
436
436
|
useLegacyQueryParams() {
|
|
437
437
|
const urlParams = new URLSearchParams(window.location.search);
|
|
438
|
+
handleFetch.log('legacy urlParams', 'info', Object.fromEntries(urlParams.entries()));
|
|
438
439
|
const getParam = (param) => {
|
|
439
440
|
const value = urlParams.get(param);
|
|
440
441
|
if (!value || value === 'undefined') {
|
|
@@ -442,40 +443,42 @@ const ZonosCheckout = class {
|
|
|
442
443
|
}
|
|
443
444
|
return value;
|
|
444
445
|
};
|
|
445
|
-
const
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
customerZip: getParam('customerZip'),
|
|
457
|
-
};
|
|
446
|
+
const country =
|
|
447
|
+
// fallback to selected country code if country is not provided
|
|
448
|
+
cart.getZCountryUrlParam(urlParams) || cart.localizationStore.selectedCountryCode;
|
|
449
|
+
const city = getParam('customerCity');
|
|
450
|
+
const email = getParam('customerEmail') || '';
|
|
451
|
+
const line1 = getParam('customerAddress1');
|
|
452
|
+
const line2 = getParam('customerAddress2') || '';
|
|
453
|
+
const name = getParam('customerName');
|
|
454
|
+
const phone = getParam('customerPhone');
|
|
455
|
+
const postal_code = getParam('customerZip') || '';
|
|
456
|
+
const state = getParam('customerState') || '';
|
|
458
457
|
// if one of the value is null, no need to preset the default address
|
|
459
|
-
if (!
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
458
|
+
if (!line1 || !city || !name || !phone || !country) {
|
|
459
|
+
handleFetch.log('Missing required query params so it can not be prefilled', 'info', [
|
|
460
|
+
!line1 && 'line1',
|
|
461
|
+
!city && 'city',
|
|
462
|
+
!name && 'name',
|
|
463
|
+
!phone && 'phone',
|
|
464
|
+
!country && 'country',
|
|
465
|
+
]
|
|
466
|
+
.filter(Boolean)
|
|
467
|
+
.join(', '));
|
|
465
468
|
return;
|
|
466
469
|
}
|
|
467
470
|
this.defaultAddress = {
|
|
468
471
|
address: {
|
|
469
|
-
city
|
|
470
|
-
country
|
|
471
|
-
line1
|
|
472
|
-
line2
|
|
473
|
-
postal_code
|
|
474
|
-
state
|
|
472
|
+
city,
|
|
473
|
+
country,
|
|
474
|
+
line1,
|
|
475
|
+
line2,
|
|
476
|
+
postal_code,
|
|
477
|
+
state,
|
|
475
478
|
},
|
|
476
|
-
email
|
|
477
|
-
name
|
|
478
|
-
phone
|
|
479
|
+
email,
|
|
480
|
+
name,
|
|
481
|
+
phone,
|
|
479
482
|
};
|
|
480
483
|
}
|
|
481
484
|
/**
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-9d0ced11.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
8
|
-
const handleFetch = require('./handleFetch-
|
|
8
|
+
const handleFetch = require('./handleFetch-5a16f2bc.js');
|
|
9
9
|
require('./isDarkColor-5efc8367.js');
|
|
10
10
|
require('./getBorderRadius-5a64574c.js');
|
|
11
11
|
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-9d0ced11.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
|
-
require('./handleFetch-
|
|
9
|
+
require('./handleFetch-5a16f2bc.js');
|
|
10
10
|
require('./isDarkColor-5efc8367.js');
|
|
11
11
|
require('./getBorderRadius-5a64574c.js');
|
|
12
12
|
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-9d0ced11.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
8
8
|
const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
|
|
9
9
|
const isDarkColor = require('./isDarkColor-5efc8367.js');
|
|
10
10
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
11
|
-
require('./handleFetch-
|
|
11
|
+
require('./handleFetch-5a16f2bc.js');
|
|
12
12
|
require('./getBorderRadius-5a64574c.js');
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-9d0ced11.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
9
|
const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
|
|
10
10
|
const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
|
|
11
|
-
require('./handleFetch-
|
|
11
|
+
require('./handleFetch-5a16f2bc.js');
|
|
12
12
|
require('./isDarkColor-5efc8367.js');
|
|
13
13
|
require('./getBorderRadius-5a64574c.js');
|
|
14
14
|
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
6
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
7
|
-
const cart = require('./cart-
|
|
7
|
+
const cart = require('./cart-9d0ced11.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
|
-
const handleFetch = require('./handleFetch-
|
|
9
|
+
const handleFetch = require('./handleFetch-5a16f2bc.js');
|
|
10
10
|
const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
|
|
11
11
|
require('./isDarkColor-5efc8367.js');
|
|
12
12
|
require('./getBorderRadius-5a64574c.js');
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-9d0ced11.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
8
8
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
9
|
-
require('./handleFetch-
|
|
9
|
+
require('./handleFetch-5a16f2bc.js');
|
|
10
10
|
require('./isDarkColor-5efc8367.js');
|
|
11
11
|
require('./getBorderRadius-5a64574c.js');
|
|
12
12
|
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
6
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
|
-
const cart = require('./cart-
|
|
9
|
-
const handleFetch = require('./handleFetch-
|
|
10
|
-
const paypal = require('./paypal-
|
|
8
|
+
const cart = require('./cart-9d0ced11.js');
|
|
9
|
+
const handleFetch = require('./handleFetch-5a16f2bc.js');
|
|
10
|
+
const paypal = require('./paypal-a6ddcfaf.js');
|
|
11
11
|
require('./isDarkColor-5efc8367.js');
|
|
12
12
|
require('./getBorderRadius-5a64574c.js');
|
|
13
13
|
|
|
@@ -227,12 +227,6 @@ export class ZonosCheckout {
|
|
|
227
227
|
catch (err) {
|
|
228
228
|
// stop loading
|
|
229
229
|
stripeStore.isFetchingSession = false;
|
|
230
|
-
cartStoreUpdateToErrorState({
|
|
231
|
-
messages: [
|
|
232
|
-
translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists"),
|
|
233
|
-
],
|
|
234
|
-
title: translate('Error creating Checkout'),
|
|
235
|
-
});
|
|
236
230
|
// We want to log the error anytime we fail to create a checkout session
|
|
237
231
|
void sendErrorLog({
|
|
238
232
|
endpoint: 'Error creating Checkout',
|
|
@@ -244,6 +238,12 @@ export class ZonosCheckout {
|
|
|
244
238
|
storeBaseUrl: (_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl,
|
|
245
239
|
},
|
|
246
240
|
});
|
|
241
|
+
cartStoreUpdateToErrorState({
|
|
242
|
+
messages: [
|
|
243
|
+
translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists"),
|
|
244
|
+
],
|
|
245
|
+
title: translate('Error creating Checkout'),
|
|
246
|
+
});
|
|
247
247
|
}
|
|
248
248
|
}, {
|
|
249
249
|
// Trigger this event before any other event
|
|
@@ -282,6 +282,7 @@ export class ZonosCheckout {
|
|
|
282
282
|
*/
|
|
283
283
|
useLegacyQueryParams() {
|
|
284
284
|
const urlParams = new URLSearchParams(window.location.search);
|
|
285
|
+
log('legacy urlParams', 'info', Object.fromEntries(urlParams.entries()));
|
|
285
286
|
const getParam = (param) => {
|
|
286
287
|
const value = urlParams.get(param);
|
|
287
288
|
if (!value || value === 'undefined') {
|
|
@@ -289,40 +290,42 @@ export class ZonosCheckout {
|
|
|
289
290
|
}
|
|
290
291
|
return value;
|
|
291
292
|
};
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
customerZip: getParam('customerZip'),
|
|
304
|
-
};
|
|
293
|
+
const country =
|
|
294
|
+
// fallback to selected country code if country is not provided
|
|
295
|
+
getZCountryUrlParam(urlParams) || localizationStore.selectedCountryCode;
|
|
296
|
+
const city = getParam('customerCity');
|
|
297
|
+
const email = getParam('customerEmail') || '';
|
|
298
|
+
const line1 = getParam('customerAddress1');
|
|
299
|
+
const line2 = getParam('customerAddress2') || '';
|
|
300
|
+
const name = getParam('customerName');
|
|
301
|
+
const phone = getParam('customerPhone');
|
|
302
|
+
const postal_code = getParam('customerZip') || '';
|
|
303
|
+
const state = getParam('customerState') || '';
|
|
305
304
|
// if one of the value is null, no need to preset the default address
|
|
306
|
-
if (!
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
305
|
+
if (!line1 || !city || !name || !phone || !country) {
|
|
306
|
+
log('Missing required query params so it can not be prefilled', 'info', [
|
|
307
|
+
!line1 && 'line1',
|
|
308
|
+
!city && 'city',
|
|
309
|
+
!name && 'name',
|
|
310
|
+
!phone && 'phone',
|
|
311
|
+
!country && 'country',
|
|
312
|
+
]
|
|
313
|
+
.filter(Boolean)
|
|
314
|
+
.join(', '));
|
|
312
315
|
return;
|
|
313
316
|
}
|
|
314
317
|
this.defaultAddress = {
|
|
315
318
|
address: {
|
|
316
|
-
city
|
|
317
|
-
country
|
|
318
|
-
line1
|
|
319
|
-
line2
|
|
320
|
-
postal_code
|
|
321
|
-
state
|
|
319
|
+
city,
|
|
320
|
+
country,
|
|
321
|
+
line1,
|
|
322
|
+
line2,
|
|
323
|
+
postal_code,
|
|
324
|
+
state,
|
|
322
325
|
},
|
|
323
|
-
email
|
|
324
|
-
name
|
|
325
|
-
phone
|
|
326
|
+
email,
|
|
327
|
+
name,
|
|
328
|
+
phone,
|
|
326
329
|
};
|
|
327
330
|
}
|
|
328
331
|
/**
|
|
@@ -197,13 +197,18 @@ const cartStoreReCalculateTotal = async ({ adjustmentsAmount, cartId, currency,
|
|
|
197
197
|
presentmentCountryCode: localizationStore.selectedCountryCode,
|
|
198
198
|
});
|
|
199
199
|
if (errors.length > 0 || !json) {
|
|
200
|
-
// do nothing if we can't get checkout session
|
|
201
200
|
logError('Error occurs when updating checkout session.');
|
|
202
201
|
if (shouldInitSessionOnFailure) {
|
|
203
202
|
log('Initiating checkout session on failure', 'info');
|
|
204
203
|
const success = await stripeStoreInitCheckoutSession();
|
|
205
204
|
log(`stripeStoreInitCheckoutSession: ${success}`);
|
|
206
205
|
if (!success) {
|
|
206
|
+
cartStoreUpdateToErrorState({
|
|
207
|
+
messages: [
|
|
208
|
+
translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists"),
|
|
209
|
+
],
|
|
210
|
+
title: translate('Error creating Checkout'),
|
|
211
|
+
});
|
|
207
212
|
return false;
|
|
208
213
|
}
|
|
209
214
|
return true;
|
|
@@ -411,8 +411,12 @@ const stripeStoreConfirmPayment = async () => {
|
|
|
411
411
|
const stripeStoreInitCheckoutSession = async () => {
|
|
412
412
|
var _a, _b;
|
|
413
413
|
const total = cartStore.items.reduce((amount, item) => amount + item.amount * item.quantity, 0);
|
|
414
|
-
if (!
|
|
415
|
-
logError(
|
|
414
|
+
if (!localizationStore.targetCurrency) {
|
|
415
|
+
logError(`Failed to create checkout session - missing localizationStore.targetCurrency`);
|
|
416
|
+
return false;
|
|
417
|
+
}
|
|
418
|
+
if (!total) {
|
|
419
|
+
logError(`Failed to create checkout session - missing total amount of items`);
|
|
416
420
|
return false;
|
|
417
421
|
}
|
|
418
422
|
stripeStore.isFetchingSession = true;
|
|
@@ -53,7 +53,7 @@ export const log = (message, type, ..._additionalInfo) => {
|
|
|
53
53
|
loggingIframe.style.visibility = 'hidden';
|
|
54
54
|
document.body.appendChild(loggingIframe);
|
|
55
55
|
}
|
|
56
|
-
// use the logging iframe's console to log just in case the console is disabled (
|
|
56
|
+
// use the logging iframe's console to log just in case the console is disabled (overridden) by the site owner
|
|
57
57
|
const zConsole = ((_b = loggingIframe.contentWindow) === null || _b === void 0 ? void 0 : _b.window.console) || window.console;
|
|
58
58
|
switch (type) {
|
|
59
59
|
case 'warn':
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as handleFetch, l as log, a as logError } from './handleFetch-
|
|
1
|
+
import { h as handleFetch, l as log, a as logError } from './handleFetch-ce924688.js';
|
|
2
2
|
|
|
3
3
|
const getTempCartById = async (cartId) => {
|
|
4
4
|
const { errors, json } = await handleFetch('/api/zonos-elements/get-temp-cart', {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as createStore, z as zonosStore } from './zonosStore-0dc7a947.js';
|
|
2
|
-
import { h as handleFetch, a as logError, l as log, f as fallbackApiList, j as jsonParse } from './handleFetch-
|
|
2
|
+
import { h as handleFetch, a as logError, l as log, f as fallbackApiList, j as jsonParse } from './handleFetch-ce924688.js';
|
|
3
3
|
import { i as isDarkColor } from './isDarkColor-b3afa948.js';
|
|
4
4
|
import { g as getBorderRadius } from './getBorderRadius-cff1e39b.js';
|
|
5
5
|
|
|
@@ -9484,8 +9484,12 @@ const stripeStoreConfirmPayment = async () => {
|
|
|
9484
9484
|
const stripeStoreInitCheckoutSession = async () => {
|
|
9485
9485
|
var _a, _b;
|
|
9486
9486
|
const total = cartStore.items.reduce((amount, item) => amount + item.amount * item.quantity, 0);
|
|
9487
|
-
if (!
|
|
9488
|
-
logError(
|
|
9487
|
+
if (!localizationStore.targetCurrency) {
|
|
9488
|
+
logError(`Failed to create checkout session - missing localizationStore.targetCurrency`);
|
|
9489
|
+
return false;
|
|
9490
|
+
}
|
|
9491
|
+
if (!total) {
|
|
9492
|
+
logError(`Failed to create checkout session - missing total amount of items`);
|
|
9489
9493
|
return false;
|
|
9490
9494
|
}
|
|
9491
9495
|
stripeStore.isFetchingSession = true;
|
|
@@ -9863,13 +9867,18 @@ const cartStoreReCalculateTotal = async ({ adjustmentsAmount, cartId, currency,
|
|
|
9863
9867
|
presentmentCountryCode: localizationStore.selectedCountryCode,
|
|
9864
9868
|
});
|
|
9865
9869
|
if (errors.length > 0 || !json) {
|
|
9866
|
-
// do nothing if we can't get checkout session
|
|
9867
9870
|
logError('Error occurs when updating checkout session.');
|
|
9868
9871
|
if (shouldInitSessionOnFailure) {
|
|
9869
9872
|
log('Initiating checkout session on failure', 'info');
|
|
9870
9873
|
const success = await stripeStoreInitCheckoutSession();
|
|
9871
9874
|
log(`stripeStoreInitCheckoutSession: ${success}`);
|
|
9872
9875
|
if (!success) {
|
|
9876
|
+
cartStoreUpdateToErrorState({
|
|
9877
|
+
messages: [
|
|
9878
|
+
translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists"),
|
|
9879
|
+
],
|
|
9880
|
+
title: translate('Error creating Checkout'),
|
|
9881
|
+
});
|
|
9873
9882
|
return false;
|
|
9874
9883
|
}
|
|
9875
9884
|
return true;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as cartStore, l as localizationStore } from './cart-
|
|
1
|
+
import { d as cartStore, l as localizationStore } from './cart-ef2e2eec.js';
|
|
2
2
|
import { z as zonosStore } from './zonosStore-0dc7a947.js';
|
|
3
|
-
import { h as handleFetch } from './handleFetch-
|
|
3
|
+
import { h as handleFetch } from './handleFetch-ce924688.js';
|
|
4
4
|
|
|
5
5
|
const trackConversionEvent = async (eventName, metadata) => {
|
|
6
6
|
var _a, _b;
|
|
@@ -53,7 +53,7 @@ const log = (message, type, ..._additionalInfo) => {
|
|
|
53
53
|
loggingIframe.style.visibility = 'hidden';
|
|
54
54
|
document.body.appendChild(loggingIframe);
|
|
55
55
|
}
|
|
56
|
-
// use the logging iframe's console to log just in case the console is disabled (
|
|
56
|
+
// use the logging iframe's console to log just in case the console is disabled (overridden) by the site owner
|
|
57
57
|
const zConsole = ((_b = loggingIframe.contentWindow) === null || _b === void 0 ? void 0 : _b.window.console) || window.console;
|
|
58
58
|
switch (type) {
|
|
59
59
|
case 'warn':
|